<?php

namespace App\Console;

use App\Console\Crons\CronRun;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')->hourly();

        // 调度任务只启动一个进程处理，如果后续希望多个进程处理，则请采用 Supervisor 配置，此处采用了
        // 互斥模式，如果出现 “No scheduled commands are ready to run”，请检查并清理缓存中存在
        // framework/schedule-* 的数据。
        $cron = new CronRun($schedule);
        $cron->run();
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
